package com.big.stock.controller;

import com.big.common.result.Result;
import com.big.model.model.stock.MerchandiseStock;
import com.big.model.vo.stock.StockVo;
import com.big.stock.service.MerchandiseStockService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/stock")
public class MerchandiseStockController {

     @Autowired
     MerchandiseStockService merchandiseStockService;

     @ApiOperation(value = "查询库存")
     @GetMapping("/stockInformation/{mId}")
     public Result Information(@PathVariable("mId") String mId){
         MerchandiseStock merchandiseStock = merchandiseStockService.merchandiseStockInfo(mId);
         return Result.ok(merchandiseStock);
     }

    @ApiOperation(value = "改变库存")
    @PostMapping("/stockChange")
    public Result stockChange(@RequestBody StockVo stockVo){
        Integer integer = merchandiseStockService.upStock(stockVo);
        return Result.ok(integer);
    }



}

